<template>
	<view class="box">
		<view class="uni-flex uni-row" v-for="(item, index) in dataList" :key="item.id" :data-id="item.id" :data-name="item.name" @tap="businessDetails" style="display: flex;margin-bottom: 5rpx; background-color: #ffffff;">
				<view>
					<view v-html="item.name" class="text" style="margin:0;padding:0;text-align: left;background-color:white;font-size: 32rpx;color:#282828;padding-left: 5%;">
						<!-- {{ item.name }} -->
					</view>
					<view v-html="item.detail" class="text" style="margin:0;padding:0;background-color:white;width:500rpx; height: 60rpx;overflow: hidden;white-space: nowrap; text-overflow: ellipsis;padding-left:10%; margin-top: -6px;">
						<!-- {{ item.detail }} -->
					</view>
				</view>
				<view class="text" style="margin:0; width: 13%; white-space:nowrap;overflow: hidden;padding: 9% 3% 0 13%;text-align: right;background-color:white;font-size:22rpx;color: #828282;">
					{{ item.create_date }}
				</view>
		</view> 
	</view>
</template>

<script>
export default {
	data() {
		return {
			url: this.baseUrl,
			documentUrl: 'https://www.1xx.online/japx/documentbytag',
			reqtype: '',
			reqname: '',
			dataList: []
		};
	},
	onLoad(options) {
		uni.setNavigationBarTitle({
			title: '查询结果'
		});
		var that = this;
		that.reqname = options.title;
		this.initDataList();
	},
	methods: {
		initDataList() {
			var that = this;
			uni.request({
				url: that.documentUrl,
				data: JSON.stringify({ params: { name: that.reqname, pubstatus: 'active' }, jsonrpc: '2.0', id: Number(new Date()) }),
				header: {
					'Content-Type': 'application/json'
				},
				method: 'POST',
				dataType: 'json',
				complete: res => {
					if (res.statusCode == 200) {
						var result = res.data.result;
						if (!!result && result.data.length > 0) {
							that.dataList = [];
							for (var i = 0; i < result.data.length; i++) {
								that.dataList.push(result.data[i]);
								console.log(that.dataList);
							}
						} else {
							uni.showModal({
								title: '提示',
								content: '没有找到相关数据！',
								success: function(res) {
									uni.navigateTo({
										url: '/pages/document/search'
									});
								}
							});
						}
					}
				}
			});
		},
		businessDetails(e) {
			var headid = e.currentTarget.dataset['id'];
			var name = e.currentTarget.dataset['name'];
			var newpage = '/pages/document/detail?headid=' + headid + '&name=' + name;
			uni.navigateTo({
				url: newpage,
				text: name
			});
		}
	}
};
</script>

<style>
.box{
	background-color: #f2f2f2;
	height:100vh
}
.uni-flex:nth-child(1){
	 border-top: 10rpx solid #f2f2f2;
}
.box {
	width: 100%;
}
.details {
	height: auto;
	padding: 24rpx;
	display: flex;
	justify-content: space-between;
	margin-bottom: 20rpx;
}
.detailsImg image {
	width: 300rpx;
	height: 200rpx;
}
.detailsinfo {
	margin-left: 20rpx;
}
.count {
	text-indent: 30rpx;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
	font-size: 24rpx;
	color: #666666;
}
.title {
	font-size: 28rpx;
	color: #030303;
	margin-bottom: 22rpx;
}
.time {
	margin-top: 22rpx;
	font-size: 20rpx;
	color: #666666;
	float: right;
}

.flex-item {
	width: 33.3%;
	height: 200rpx;
	text-align: center;
	line-height: 200rpx;
}

.flex-item-V {
	width: 100%;
	height: 150rpx;
	text-align: center;
	line-height: 150rpx;
}

.text {
	margin: 15rpx 10rpx;
	padding: 0 20rpx;
	background-color: #ebebeb;
	/* height: 70rpx; */
	line-height: 70rpx;
	text-align: center;
	color: #777;
	font-size: 26rpx;
}

.desc {
	/* text-indent: 40rpx; */
}



/* 新加的样式 */
.text:nth-child(2) >>> *{
	color: rgb(51, 51, 51) !important;
	font-size: 25rpx !important;
	font-family:"Microsoft YaHei" !important;
	/* letter-spacing: 0px !important; */
}
</style>
